﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Framework.Modules;
using Microsoft.Practices.Unity;

namespace Framework
{
	public static class Bootstrapper
	{
		public static void Initialize()
		{
			var container = new UnityContainer();

			container.RegisterType<IControllerFactory, ControllerFactory>();
			container.RegisterType<IControllerActivator, ControllerActivator>();

			container.RegisterType<IViewPageActivator, ViewPageActivator>();

			DependencyResolver.SetResolver(new UnityDependencyResolver(container));
			ModulesInitializer.Initialize(container);
	
			var engine = new ViewEngine(typeof(Bootstrapper).Assembly, container) { UsePhysicalViewsIfNewer = true };
			ViewEngines.Engines.Add(engine);
		}

	}
}
